@extends('front.common.header')

@section('title','就业指南')
@section('content')
@include('UEditor::head')
<link href="{{ asset('/css/employ/list.css') }}" rel="stylesheet" type="text/css">

<div class="main">
    <div class="employ-list clearfix" style="padding-top:30px;">
        <form id="employForm">
        <div class="employ-list-left fl">
            <div class="employ-search">
                <div class="upload-title">
                    <a href="javascript:void(0);" onclick="history.go(-1)"><i class="icon-angle-left"></i>&nbsp;&nbsp;返回</a>
                </div>
                <div class="teaches-upload-content clearfix">
                    <div class="teaches-form-main" style="width:100%;">
                        <div class="form-group clearfix">
                            <div class="col-xs-12 col-sm-2 col-2 ft-16 cor-2">文章名称：</div>
                            <div class="col-sm-10 col-xs-12"> 
                                <input type="text" class="form-control" name="title" placeholder="文档名称" value={{!empty($result)?$result->title:''}}>
                                <div class="help-block" id="error" style="color:red;"></div>
                            </div>
                         </div>
                         <div class="form-group">
                            <div class="col-xs-12 col-sm-2 col-2 ft-16 cor-2">文章分类：</div>
                            <div class="col-sm-4 col-xs-12" id="parent">
                                <select name="type" class="form-control" id="type" onchange="getChilds('category',this.value,'parent')">
                                    <option value="0">请选择分类</option>
                                    @foreach($type as $tp)
                                    <option value="{{ $tp->cat_id }}" @if(!empty($result)) @if(in_array($tp->cat_id,$categorys['id'])) selected @endif @endif>{{ $tp->cat_name }}</option>
                                    @endforeach
                                </select>
                            </div>
                            @if(!empty($result))
                                @if($item != 5)
                                @foreach($categorys['list'] as $k=>$cglist)
                                    <div class="col-sm-3 col-xs-12" id="child_{{$k-$item}}">
                                        <select name="child_{{ $k-$item }}" class="form-control" id="child_{{$k}}" onchange="getChilds(this.value,'child_{{ $k-$item }}')">
                                    		<option value="0">请选择分类</option>
                                    		@foreach($cglist as $cgl)
                                    		<option value="{{ $cgl->cat_id }}" @if(in_array($cgl->cat_id,$categorys['id'])) selected @endif>{{ $cgl->cat_name }}</option>
                                    		@endforeach
                                    	</select>
                                    </div>
                                @endforeach
                                @endif
                                @if($item ==5)
                                <div class="col-sm-3 col-xs-12" id="child_1"></div>
                                <div class="col-sm-3 col-xs-12" id="child_2"></div>
                                <div class="col-sm-3 col-xs-12" id="child_3"></div>
                                @elseif($item==4)
                                <div class="col-sm-3 col-xs-12" id="child_2"></div>
                                <div class="col-sm-3 col-xs-12" id="child_3"></div>
                                @elseif($item == 3)
                                <div class="col-sm-3 col-xs-12" id="child_3"></div>
                                @endif
                            @else
                            <div class="col-sm-3 col-xs-12" id="child_1"></div>
                            <div class="col-sm-3 col-xs-12" id="child_2"></div>
                            <div class="col-sm-3 col-xs-12" id="child_3"></div>
                            @endif
                            <div class="clearfix"></div>
                        </div> 
                         <div class="form-group clearfix">
                            <div class="col-xs-12 col-sm-2 col-2 ft-16 cor-2">封面图片：</div>
                            <div class="col-sm-10 col-xs-12"> 
                                <div class="input-group ">
                                	<input type="hidden" name="thumb" id="thumb" value="{{!empty($result)?$result->thumb:0}}">
                                	<input type="text" name="logo" value="{{empty($result)?'':(count($result->attachment)>0 ? $result->attachment->url:'')}}" class="form-control" autocomplete="off">
                                	<span class="input-group-btn">
                                		<button class="btn btn-default" style="height:43px;" type="button" onclick="showImageDialog(this, '{{$opts}}',{{$options}});">选择图片</button>
                                	</span>
                                </div>
                                <div class="input-group " style="margin-top:.5em;margin-left: 0px;">
                    				<img src="{{empty($result)?asset('/images/nopic.jpg'):(count($result->attachment)>0 ? $result->attachment->url:'')}}" onerror="this.src='/images/nopic.jpg'; this.title='图片未找到.'" class="img-responsive img-thumbnail" width="150">
                    				<em class="close" style="position:absolute; top: 0px; right: -18px;" title="删除这张图片" onclick="deleteImage(this)">×</em>
                    			</div>
                            </div>
                        </div>
                        <div class="form-group clearfix">
                            <div class="col-xs-12 col-sm-2 col-2 ft-16 cor-2">文章简介：</div>
                            <div class="col-sm-10 col-xs-12"> 
                                <textarea rows="3" class="form-control" name="description" cols="5">@if(!empty($result)) {{strip_tags($result->description)}} @endif</textarea>
                            </div>
                         </div>
                         <div class="form-group clearfix">
                            <div class="col-xs-12 col-sm-2 col-2 ft-16 cor-2">文章内容：</div>
                            <div class="col-sm-10 col-xs-12"> 
                                <script id="content" name="content"  style="width:100%;margin:0 auto;height:300px;" type="text/plain"></script>
                            </div>
                        </div>
                        <div class="form-group clearfix">
                            <div class="col-xs-12 col-sm-2 col-2 ft-16 cor-2">标签：</div>
                            <div class="col-sm-10 col-xs-12"> 
                                <div class="tagsinput-primary">
                                    <input name="tagsinput" class="tagsinput" data-role="tagsinput" value="@if(!empty($newstag)){{ $newstag }}@endif" />
                                </div>
                            </div>
                        </div>
                        <div class="form-group clearfix">
                            <div class="col-xs-12 col-sm-2 col-2 ft-16 cor-2">作者：</div>
                            <div class="col-sm-2 col-xs-12"> 
                                <input name="author" class="form-control" type="text" value="@if(!empty($result)){{ $result->author }}@endif" />
                            </div>
                            <div class="col-xs-12 col-sm-2 col-2 ft-16 cor-2">来源：</div>
                            <div class="col-sm-2 col-xs-12"> 
                                <input name="from" class="form-control" type="text" value="@if(!empty($result)){{ $result->from }}@endif" />
                            </div>
                            <div class="col-xs-12 col-sm-2 col-2 ft-16 cor-2">售价：</div>
                            <div class="col-sm-2 col-xs-12"> 
                                <input name="price" class="form-control" type="number" value="@if(!empty($result)){{ count($result->exts)>0?$result->exts->price:0 }}@endif" />
                            </div>
                        </div>
                    </div>
                </div>
                <div class="save-button-group clearfix">
                    {!! csrf_field() !!}
                    <input type="hidden" name="newsid" value="{{!empty($result)?$result->id:0}}">
                    <div class="form-group float-r">
                      <button type="button" class="btn btn-upload-style" onclick="saveData('/member/index','employForm','')">
                            <i class="icon-ok bigger-110"></i>完成上传
                      </button>  
                    </div>
                </div>
            </div>
        </div>
        </form>
        <div class="employ-list-right fl">
            <div class="employ-list-tips">
                <div class="tips-title font-16">文档上传须知</div>
                <div class="teaches-upload-tips" >
                    <p>1、请勿上传国家法律禁止的内容</p>
                    <p>2、不得上传涉及侵权内容的文档</p>
                    <p>3、请勿上传涉嫌泄密的内容</p>
                    <p>4、请勿上传带有商业广告的文档</p>
                    <p>5、上传文件大小限制在50M以内</p>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
<!--

var ue = UE.getEditor('content');
ue.ready(function() {
    ue.execCommand('serverparam', '_token', '{{ csrf_token() }}');//此处为支持laravel5 csrf ,根据实际情况修改,目的就是设置 _token 值.
    ue.setContent('@if(!empty($result)){!! $result->content !!}@endif');
});

//-->
</script>
@stop
